/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package comandaXM.utils;
import java.awt.Rectangle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.event.ListSelectionEvent;
import comandaXM.excepcions.ExceptionHibernate;  
import comandaXM.excepcions.ExceptionXML;  
import comandaXM.utils.format.*; 
import java.awt.event.MouseEvent;


/**
 * dialag abastracata
 * @author xmarti
 */
public abstract class JDialogXM extends javax.swing.JDialog {
    private JTableXM jTable; 
    private TableModel model;         
    private boolean insert;
    private boolean selection;
    private boolean valid; 
//    private boolean saved; 

    
    private String path;
    private Object object; 
    private FormatJDialog formatTable;
    
    public JDialogXM(java.awt.Frame parent, boolean modal,String path,String titleDialog) {
        super(parent, modal);        
        initComponents();
        this.setTitle(titleDialog);
//        this.saved=true; 
        this.path=path;
        this.formatTable = null; 
        this.jTable= new JTableXM() {
            @Override
            public void handleSelectionEvent(ListSelectionEvent e) {
               selectionEvent(e);
            }

            @Override
            public void doubleClick(MouseEvent e) {
              
            }

            
        };
        
                
        this.jScrollPaneTable.setViewportView(this.jTable);
        this.jTable.setToolTipText(TDSLanguageUtils.getMessage("jDialogXM.JTable.toolTipText"));
        
        enabledObjects(false);
        this.selection=true; 
        this.jLabelAction.setText(EnumAction.SELECT.getAction());   
        this.jTextCercar.requestFocus();
    }
    private void enabledObjects(boolean modify){
       this.jScrollPaneData.setVisible(modify);
       this.jButtonSave.setEnabled(modify);
       this.jButtonRemove.setEnabled(modify);
       //if(modify) this..requestFocus();
       // this.jScrollPaneTable.repaint();
        //pack();
   }
    public void incrementarPosRegistre( int increment){        
        if (this.jTable.getSelectedRow()>0 && increment==-1) {
            int i= this.jTable.getSelectedRow(); 
            this.jTable.setRowSelectionInterval(i+increment, i+increment);
        }else  if (increment==1 && this.jTable.getSelectedRow()< this.jTable.getRowCount()-1 ) {
            int i= this.jTable.getSelectedRow(); 
            this.jTable.setRowSelectionInterval(i+increment, i+increment);
        }
        
    }
    
    public void chargeTable() throws ExceptionHibernate, ExceptionXML{        
        
        if (this.formatTable==null) {
            this.formatTable= new FormatJDialog(this.jTable,this.path,this);            
        }
        else this.formatTable.setFormat();        
        this.jTable.chargeModel(this.getModel(this.jTextCercar.getText()));
        if (this.formatTable!=null)this.formatTable.chargeFormat();
    }
    public abstract TableModel getModel(String textToSearch) throws ExceptionHibernate;
    public abstract void getData() throws ExceptionHibernate;
    public abstract void setData();
    public abstract boolean validation(); 
    public abstract void saveData() throws ExceptionHibernate;
    public abstract void removeData() throws ExceptionHibernate;
    public abstract boolean  isSaved();
    
    public boolean isInsert() {
        return insert;
    }

    public void setInsert(boolean insert) {
        this.insert = insert;
    }
    public boolean isValid (){
        return this.valid; 
    }
    public void setValid(boolean valid){
        this.valid=valid; 
    }
//    public boolean isSaved() {
//        return saved;
//    }
//
//    public void setSaved(boolean saved) {
//        this.saved = saved;
//    }

    public JScrollPane getjPanelData() {
        return this.jScrollPaneData;
    }


    public Object getObject() {
        return object;
    }

    public void setObject(Object object) {
        this.object = object;
    }
    public void setAction (String action){
        this.jLabelAction.setText(action);
    }
    
    
    private void selectData(Object object){
       int i = this.jTable.getIndex(object);
            this.selection=false; 
            if (i>-1) {
                this.enabledObjects(true);
                this.jTable.setRowSelectionInterval(i, i);
                this.jTable.setScroll();
                
            }else {
                this.jTable.clearSelection(); 
                this.enabledObjects(false);
                
                
            }
            this.selection=true; 
   }
    
    
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButtonRemove = new javax.swing.JButton();
        jButtonExit = new javax.swing.JButton();
        jScrollPaneTable = new javax.swing.JScrollPane();
        jButtonNew = new javax.swing.JButton();
        jButtonSave = new javax.swing.JButton();
        jLabelAction = new javax.swing.JLabel();
        jScrollPaneData = new javax.swing.JScrollPane();
        jPanel1 = new javax.swing.JPanel();
        jTextCercar = new javax.swing.JTextField();
        jButtonCercar = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jButtonRemove.setIcon(new javax.swing.ImageIcon(getClass().getResource("/comandaXM/images/BotoBorrar.png"))); // NOI18N
        jButtonRemove.setMnemonic('E');
        jButtonRemove.setText(TDSLanguageUtils.getMessage("jDialogXM.JButton.remove.caption"));
        jButtonRemove.setToolTipText(TDSLanguageUtils.getMessage("jDialogXM.JButton.remove.toolTipText"));
        jButtonRemove.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButtonRemove.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButtonRemove.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonRemoveActionPerformed(evt);
            }
        });

        jButtonExit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/comandaXM/images/BotoSortir.png"))); // NOI18N
        jButtonExit.setMnemonic('S');
        jButtonExit.setText(TDSLanguageUtils.getMessage("jDialogXM.JButton.exit.caption"));
        jButtonExit.setToolTipText(TDSLanguageUtils.getMessage("jDialogXM.JButton.exit.toolTipText"));
        jButtonExit.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButtonExit.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButtonExit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonExitActionPerformed(evt);
            }
        });

        jScrollPaneTable.setMinimumSize(new java.awt.Dimension(5, 5));

        jButtonNew.setIcon(new javax.swing.ImageIcon(getClass().getResource("/comandaXM/images/BotoNou.png"))); // NOI18N
        jButtonNew.setMnemonic('N');
        jButtonNew.setText(TDSLanguageUtils.getMessage("jDialogXM.JButton.new.caption"));
        jButtonNew.setToolTipText(TDSLanguageUtils.getMessage("jDialogXM.JButton.new.toolTipText"));
        jButtonNew.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButtonNew.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButtonNew.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonNewActionPerformed(evt);
            }
        });

        jButtonSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/comandaXM/images/BotoGuardar.png"))); // NOI18N
        jButtonSave.setMnemonic('G');
        jButtonSave.setText(TDSLanguageUtils.getMessage("jDialogXM.JButton.save.caption"));
        jButtonSave.setToolTipText(TDSLanguageUtils.getMessage("jDialogXM.JButton.save.toolTipText"));
        jButtonSave.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButtonSave.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButtonSave.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonSaveActionPerformed(evt);
            }
        });

        jLabelAction.setFont(new java.awt.Font("Tahoma", 3, 14)); // NOI18N
        jLabelAction.setForeground(new java.awt.Color(0, 102, 255));
        jLabelAction.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);

        jScrollPaneData.setBorder(javax.swing.BorderFactory.createTitledBorder("Hola"));
        jScrollPaneData.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        jScrollPaneData.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
        jScrollPaneData.setMinimumSize(new java.awt.Dimension(10, 28));

        jPanel1.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true));

        jButtonCercar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/comandaXM/images/BotoCercarPetit.png"))); // NOI18N
        jButtonCercar.setToolTipText(TDSLanguageUtils.getMessage("jDialogXM.JButton.search.toolTipText"));
        jButtonCercar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonCercarActionPerformed(evt);
            }
        });

        jLabel1.setText(TDSLanguageUtils.getMessage("jDialogXM.JLabel.search.caption"));

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(9, 9, 9)
                        .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(5, 5, 5))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jTextCercar, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                .addComponent(jButtonCercar)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(9, 9, 9)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jButtonCercar, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jTextCercar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE))))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jButtonNew, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButtonSave, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButtonRemove, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 16, Short.MAX_VALUE)
                        .addComponent(jButtonExit, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jScrollPaneData, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jScrollPaneTable, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jLabelAction, javax.swing.GroupLayout.PREFERRED_SIZE, 498, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jButtonSave, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jButtonRemove, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jButtonExit, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jButtonNew, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPaneTable, javax.swing.GroupLayout.DEFAULT_SIZE, 286, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPaneData, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(8, 8, 8)
                .addComponent(jLabelAction, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButtonRemoveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonRemoveActionPerformed
        
        if(Utils.confirmRemoveOptionPane(TDSLanguageUtils.getMessage("jDialogXM.remove.description"))==0){           
           try {
                removeData();                
                this.jLabelAction.setText(EnumAction.OK_REMOVE.getAction()); 
                this.jLabelAction.setForeground(Utils.getColorOk());
                selectData(this.object);
                this.chargeTable();
                if (this.formatTable!=null)this.formatTable.chargeFormat();
                 
            } catch (ExceptionHibernate ex) {
                this.jLabelAction.setText(EnumAction.NO_REMOVE.getAction());  
                this.jLabelAction.setForeground(Utils.getColorError());
                JOptionPane.showMessageDialog(null,ex.getMessage() ,TDSLanguageUtils.getMessage("remove.data.ERR"),JOptionPane.ERROR_MESSAGE);
            } catch (Exception ex) {
                //error write xml
                Logger.getLogger(JDialogXM.class.getName()).log(Level.SEVERE, null, ex);
            }
            //this.saved=true;
        }
    }//GEN-LAST:event_jButtonRemoveActionPerformed

    private void jButtonExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonExitActionPerformed
        this.formatTable.setFormat();
        try {
            this.formatTable.saveFormat();
        } catch (ExceptionXML ex) {
            Logger.getLogger(JDialogXM.class.getName()).log(Level.SEVERE, null, ex);
        }
        this.dispose();

    }//GEN-LAST:event_jButtonExitActionPerformed

    private void jButtonNewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNewActionPerformed
        this.insert=true;
        this.jLabelAction.setText(EnumAction.INSERT.getAction());
        this.jLabelAction.setForeground(Utils.getColorOk());
        this.jScrollPaneData.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true),TDSLanguageUtils.getMessage("jDialogState.JPanelState.new.caption")));
        enabledObjects(true);
        this.jTable.clearSelection(); 
        setData();        
    }//GEN-LAST:event_jButtonNewActionPerformed

    private void jButtonSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSaveActionPerformed
        
        if (this.validation()){
            try {
                this.saveData();            
                //this.getFormat();
                if (this.insert){
                    this.jLabelAction.setText(EnumAction.OK_INSERT.getAction());
                }else{
                    this.jLabelAction.setText(EnumAction.OK_UPDATE.getAction());
                }
                this.jLabelAction.setForeground(Utils.getColorOk());
                this.setInsert(false);

                this.chargeTable(); 
                this.selectData(this.object);
            } catch (ExceptionHibernate ex) {
                if (this.insert){
                    this.jLabelAction.setText(EnumAction.NO_INSERT.getAction());
                }else{
                    this.jLabelAction.setText(EnumAction.NO_UPDATE.getAction());
                }
                this.jLabelAction.setForeground(Utils.getColorError());
                JOptionPane.showMessageDialog(null,ex.getMessage() ,TDSLanguageUtils.getMessage("save.data.ERR"),JOptionPane.ERROR_MESSAGE);

            } catch (ExceptionXML ex) {            
                //error write xml
                Logger.getLogger(JDialogXM.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
       
    }//GEN-LAST:event_jButtonSaveActionPerformed
    
    private void jButtonCercarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCercarActionPerformed
        try {
            this.chargeTable();
            enabledObjects(false);
            if (this.formatTable!=null)this.formatTable.chargeFormat();
            this.jLabelAction.setForeground(Utils.getColorOk());
            this.jLabelAction.setText(EnumAction.SELECT.getAction());        
                
        } catch (ExceptionHibernate ex) {
               JOptionPane.showMessageDialog(null,ex.getMessage() ,TDSLanguageUtils.getMessage("select.data.ERR"),JOptionPane.ERROR_MESSAGE);
        } catch (ExceptionXML ex) {
            Logger.getLogger(JDialogXM.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jButtonCercarActionPerformed

    private void selectionEvent(ListSelectionEvent e){             
            if(this.jTable.getSelectedRow()>-1){                                               
                if(!this.isSaved()){
                    //saved=true;    
                    if(this.validation()){ 
                        if(Utils.confirmSaveOptionPane(TDSLanguageUtils.getMessage("jDialogType.confirm.save.caption"))==0) {                      
                            Object objectNext =(Object) this.jTable.getValueAt(this.jTable.getSelectedRow(),0); 
                                                                  
                            try{
                            saveData();
                            this.setInsert(false);
                            this.chargeTable(); 
                            selectData(objectNext);
                            this.object=objectNext; 
                                //getFormat();
                            } catch (ExceptionHibernate  ex) {
                                if (this.insert){
                                    this.jLabelAction.setText(EnumAction.NO_INSERT.getAction());
                                }else{
                                    this.jLabelAction.setText(EnumAction.NO_UPDATE.getAction());                
                                }
                                this.jLabelAction.setForeground(Utils.getColorError());
                                JOptionPane.showMessageDialog(null,ex.getMessage() ,TDSLanguageUtils.getMessage("save.data.ERR"),JOptionPane.ERROR_MESSAGE);
                            } catch (ExceptionXML ex) {
                                // xml exception
                                Logger.getLogger(JDialogXM.class.getName()).log(Level.SEVERE, null, ex);
                            }
                        }else{
                            this.object=(Object) this.jTable.getValueAt(this.jTable.getSelectedRow(),0); 
                        }
                    }else{
                        this.object=(Object) this.jTable.getValueAt(this.jTable.getSelectedRow(),0); 
                    }
                }else{
                    this.object=(Object) this.jTable.getValueAt(this.jTable.getSelectedRow(),0); 
                }
                
                if (this.object.toString()==null) {
                    this.insert=true;  
                    this.jLabelAction.setText(EnumAction.INSERT.getAction());
                    
                } else{
                    this.jScrollPaneData.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true),TDSLanguageUtils.getMessage("jDialogState.JPanelState.update.caption")+this.object.toString()));
                    if(this.selection)  this.jLabelAction.setText(EnumAction.UPDATE.getAction());
                    this.insert=false;                     
                }                
                this.jLabelAction.setForeground(Utils.getColorOk());
                enabledObjects(true);
                setData();
                this.jTable.scrollRectToVisible(new Rectangle(this.jTable.getCellRect(this.jTable.getSelectedRow(), 0, true)));                                                   
               
            }
        }

    
    /**
     * @param args the command line arguments
     */
//    public static void main(String args[]) {
//        /* Set the Nimbus look and feel */
//        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
//        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
//         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
//         */
//        try {
//            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
//                if ("Nimbus".equals(info.getName())) {
//                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
//                    break;
//                }
//            }
//        } catch (ClassNotFoundException ex) {
//            java.util.logging.Logger.getLogger(JDialogXM.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (InstantiationException ex) {
//            java.util.logging.Logger.getLogger(JDialogXM.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (IllegalAccessException ex) {
//            java.util.logging.Logger.getLogger(JDialogXM.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
//            java.util.logging.Logger.getLogger(JDialogXM.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        }
//        //</editor-fold>
//
//        /* Create and display the dialog */
//        java.awt.EventQueue.invokeLater(new Runnable() {
//            public void run() {
//                JDialogXM dialog = new JDialogXM(new javax.swing.JFrame(), true);
//                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
//                    @Override
//                    public void windowClosing(java.awt.event.WindowEvent e) {
//                        System.exit(0);
//                    }
//                });
//                dialog.setVisible(true);
//            }
//        });
//    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButtonCercar;
    private javax.swing.JButton jButtonExit;
    private javax.swing.JButton jButtonNew;
    private javax.swing.JButton jButtonRemove;
    private javax.swing.JButton jButtonSave;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabelAction;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPaneData;
    private javax.swing.JScrollPane jScrollPaneTable;
    private javax.swing.JTextField jTextCercar;
    // End of variables declaration//GEN-END:variables

}
